package cn.infinite.security.util;

public class HttpProtocolUtil {

    public static final String HTTP_PREFIX = "http";
    public static final String HTTPS_PREFIX = "https";

    /**
     * 如果启用https ,则将http链接转换为https
     *
     * @param url
     * @return
     */
    public static String parseToHttps(String url) {
        if (url.startsWith(HTTPS_PREFIX)) {
            return url;
        }
        return url.replaceFirst(HTTP_PREFIX, HTTPS_PREFIX);
    }
}
